package com.wanmait.community.controller;

import com.wanmait.community.entity.OperationLog;
import com.wanmait.community.service.OperationLogService;
import com.wanmait.community.util.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("admin/operationLog")
public class OperationLogController {
    @Resource
    private OperationLogService operationLogService;
    @GetMapping("list")
    public AjaxResult list() {
        List<OperationLog> operationLogs = operationLogService.findAll();
        return AjaxResult.success().put("operationLogs", operationLogs);
    }
    @GetMapping("{id}")
    public AjaxResult getOperationLogByAdminId(@PathVariable Integer id) {
        List<OperationLog> operationLogs = operationLogService.findByAdminId(id);
        return AjaxResult.success().put("operationLogs", operationLogs);
    }
}
